package com.smilive.start.netty.chat.server.impl;

import com.smilive.start.netty.chat.server.UserService;

import java.util.HashMap;
import java.util.Map;

/**
 * @program: netty
 * @Date: 2022-01-06 14:11
 * @Author: smilive
 * @Description:
 */
public class UserServiceImpl implements UserService {

    private final static Map<String,String> users = new HashMap<>();

    static {
        users.put("zhangsan","12345");
        users.put("lisi","12345");
        users.put("wangwu","12345");
    }

    @Override
    public boolean login(String username, String password) {
        String pwad = users.get(username);
        if (password == null || !password.equals(pwad)){
            return false;
        }
        return true;
    }
}
